package com.yituo.mjworld.mvc.entity.web;

import com.yituo.mjworld.core.annotation.Rules;
import com.yituo.mjworld.core.web.core.BaseForm;

import javax.persistence.*;

@Entity
@Table(name = "web_banner", schema = "web_mojianworld_server", catalog = "")
public class WebBanner extends BaseForm {

  @Rules(fieldName = "ID", id = true)
  public int id;
  @Rules(fieldName = "展示优先级")
  public int orderNum;
  @Rules(fieldName = "展示的URL")
  public String imgUrl;
  @Rules(fieldName = "商品ID")
  public int productId;
  @Rules(fieldName = "是否使用产品图")
  public boolean isUseProductImg;

  @Id
  @Column(name = "id", nullable = false)
  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  @Basic
  @Column(name = "orderNum", nullable = false)
  public int getOrderNum() {
    return orderNum;
  }

  public void setOrderNum(int orderNum) {
    this.orderNum = orderNum;
  }

  @Basic
  @Column(name = "imgUrl", nullable = false, length = 255)
  public String getImgUrl() {
    return imgUrl;
  }

  public void setImgUrl(String imgUrl) {
    this.imgUrl = imgUrl;
  }

  @Basic
  @Column(name = "productId", nullable = false)
  public int getProductId() {
    return productId;
  }

  public void setProductId(int productId) {
    this.productId = productId;
  }

  @Basic
  @Column(name = "isUseProductImg", nullable = false)
  public boolean getIsUseProductImg() {
    return isUseProductImg;
  }

  public void setIsUseProductImg(boolean isUseProductImg) {
    this.isUseProductImg = isUseProductImg;
  }


  @Override
  public int hashCode() {
    int result = id;
    result = 31 * result + orderNum;
    result = 31 * result + (imgUrl != null ? imgUrl.hashCode() : 0);
    result = 31 * result + productId;
    return result;
  }

  @Override
  public boolean validate() {
    return defaultValidate();
  }
}
